<%@ include file = "/ini.jsp"%> 
<HTML xmlns:fc>
<head>
<title>打印</title>
<style>
	@media all 
	{
	  fc\:fc_code 
	  {
	    behavior: url(fc_code.htc) ;
	  }

	.previewDiv { BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #0000cd 2px outset; BORDER-LEFT: #0000cd 2px ridge; BORDER-RIGHT: #0000cd 2px outset; BORDER-TOP: #0000cd 2px ridge;  OVERFLOW: hidden;  WIDTH:pxRatemm*297;HEIGHT:pxRatemm*210; }
	.userData{behavior:url(#default#userData);}
	.pagemargin {position:absolute;BACKGROUND-COLOR: #ffffff;z-index:9;top:0;left:0;width:0;height:0;display:none} //置在上面
	  
	}	
</style>
<SCRIPT language=javaScript src="public.js"></SCRIPT>
<SCRIPT language=javaScript>

var prnSet=window.dialogArguments

var pxRatemm=3.78*(297-prnSet.offsetAdjust)/297

var alltable =prnSet.alltable
var ReportName=prnSet.ReportName
var SetColWidth=prnSet.SetColWidth
var title1=prnSet.title1
var title2=prnSet.title2
var top11=prnSet.top11
var top12=prnSet.top12
var top13=prnSet.top13
var top21=prnSet.top21
var top22=prnSet.top22
var top23=prnSet.top23
var top31=prnSet.top31
var top32=prnSet.top32
var top33=prnSet.top33
var bottom11=prnSet.bottom11
var bottom12=prnSet.bottom12
var bottom13=prnSet.bottom13
var bottom21=prnSet.bottom21
var bottom22=prnSet.bottom22
var bottom23=prnSet.bottom23
var bottom31=prnSet.bottom31
var bottom32=prnSet.bottom32
var bottom33=prnSet.bottom33
var fontTop=prnSet.fontTop
var fontBottom=prnSet.fontBottom

var repWidth=prnSet.repWidth*pxRatemm	
var repHeight=prnSet.repHeight*pxRatemm	
var portrait=prnSet.portrait	
var level=prnSet.level	
var tabTop=prnSet.tabTop
var	tabBottom=prnSet.tabBottom 
var	tabLeft=prnSet.tabLeft 
var	tabRight=prnSet.tabRight 
var	tabHead=prnSet.tabHead 
var tabCauda=prnSet.tabCauda 
var topOffset=prnSet.topOffset 
var	leftOffset=prnSet.leftOffset 
var	rightOffset=prnSet.rightOffset 
var	bottomOffset=prnSet.bottomOffset 
var	coverPrint=prnSet.coverPrint 
var	AutoturnRow=prnSet.AutoturnRow 
var imgsrc=prnSet.imgsrc 
var imgshow=prnSet.imgshow 
var	imgLeft=prnSet.imgLeft 
var	imgTop=prnSet.imgTop 
var changeUserDate=prnSet.changeUserDate 
/////////
var userData
var strCol="<COLGROUP>"
var	PageHeadHTML=""
var PageHeadHeight=0;
var PageCaudaHeight=0;
var PageCaudaHTML=""
var perPageHTML="";
var allWidth=0 
var oRectXml="<root>"
var oCoorXml="<root>"
var tabstyle="";
var Pages=0;
var cur1=0
var arrPage=new Array()
var iBound=0
var Maxj=0
var MaxCols=1
var sumcol=0
var heightTop=0
var heightBottom=0
var htmlTop=""
var htmlBottom=""
var allPageHTML=""
var lngPageMargin=20
var effectiveWidth=0
var newdivnum=0;
var TopBottomHtml="<TABLE border=0  id=repTop style='TABLE-LAYOUT: fixed;word-break:break-all;position:absolute;left:0;top:0 ;' cellPadding=0 cellSpacing=0><TR><TD colspan=3 align=center></TD></TR><TR><TD colspan=3 align=center></TD></TR>"
+"<TR><TD align=left width=33.3%></TD><TD align=center  width=33.3%></TD><TD align=right  width=33.3% ></TD></TR>"
+"<TR><TD align=left width=33.3%></TD><TD align=center  width=33.3%></TD><TD align=right  width=33.3% ></TD></TR>"
+"<TR><TD align=left width=33.3%></TD><TD align=center  width=33.3%></TD><TD align=right  width=33.3% ></TD></TR>"
+"</TABLE>"
+"<TABLE border=0 id=repBottom style='TABLE-LAYOUT: fixed;position:absolute;word-break:break-all' cellPadding=0 cellSpacing=0>"
+"<TR><TD align=left width=33.3%></TD><TD align=center  width=33.3%></TD><TD align=right  width=33.3% ></TD></TR>"
+"<TR><TD align=left width=33.3%></TD><TD align=center  width=33.3%></TD><TD align=right  width=33.3% ></TD></TR>"
+"<TR><TD align=left width=33.3%></TD><TD align=center  width=33.3%></TD><TD align=right  width=33.3% ></TD></TR>"
+"</TABLE>"


function refreshPage(){
	strCol="<COLGROUP>"
	repWidth=pxRatemm*210
	repHeight=pxRatemm*297
	portrait=true
	level=false
	CaptionTop=20
	CaptionBottom=20
	tabTop=50
	tabBottom=50
	tabLeft=20
	tabRight=20
	tabHead=1
	tabCauda=0
	topOffset=20
	leftOffset=10
	coverPrint=false
	AutoturnRow=true
	imgsrc=escape("top.gif")
	imgshow=false
	imgLeft=50
	imgTop=100
	 PageHeadHTML=""
	 PageHeadHeight=0;
	 PageCaudaHeight=0;
	 PageCaudaHTML=""
	 perPageHTML="";
	 allWidth=0 
	 oRectXml="<root>"
	 oCoorXml="<root>"
	 tabstyle="";
	 Pages=0;
	 cur1=0
	 arrPage=new Array()
	 iBound=0
	 Maxj=0
	 MaxCols=1	
	 sumcol=0
	 fontTop=15
	 fontBottom=13
	 heightTop=0
	 heightBottom=0
	 htmlTop=""
	 htmlBottom=""
	 biglabel.innerHTML ="" 	 
	 loadtab.innerHTML =""
	 loadtab.innerHTML=alltable
	 sumMerge()
	 loadtab.innerHTML =""
	 loadtab.innerHTML=alltable+TopBottomHtml
	 t.style.position="absolute";
	 t.style.tableLayout="fixed"
	 getformat()
	 getcolwidth()
	 getappendInfo()
	 detachPage()  
	 instantiationPage()
}
function init(){
	
	
	loadtab.innerHTML=alltable
	var o=t.all.tags("INPUT")
	for(var i=0;i<o.length;i++){
		o[i].onclick=""
	}
	var o=t.all.tags("A")
	for(var i=0;i<o.length;i++){
		o[i].removeAttribute("href")
		o[i].removeAttribute("onclick")		
	}

	t.removeAttribute("onmousemove")
	t.removeAttribute("onmousedown")
	t.removeAttribute("onmouseup")
	t.removeAttribute("onclick")
	t.removeAttribute("ondblclick")

	t.removeAttribute("graph")
	t.removeAttribute("recordsetxml")
	t.removeAttribute("buttonxml")
	t.removeAttribute("runpara")
	t.removeAttribute("initwhere")
	t.removeAttribute("fixcols")
	t.removeAttribute("fixrows")
	t.removeAttribute("userdata")
	t.removeAttribute("pagerun")
	t.removeAttribute("addlinerun")
	t.removeAttribute("conditionact")
	t.removeAttribute("condition")
	t.removeAttribute("afterrunsql")
	t.removeAttribute("queryorder")

	alltable=loadtab.innerHTML
		
	sumMerge()
	loadtab.innerHTML =""
	loadtab.innerHTML=alltable+TopBottomHtml
	t.style.position="absolute";
	t.style.tableLayout="fixed"
	
	var setReturn=setuserData()
	if (setReturn=="Error"){
		self.close ()
		return
	}
	
	getformat()
	getcolwidth()
	getappendInfo()
	detachPage()

}
function setuserData(){
	//if (changeUserDate==true){		
		SaveUserData("setcolwidth","ReportColWidth"+ReportName,SetColWidth)	
	//}

	var colwidthXML=LoadUserData("setcolwidth","ReportColWidth"+ReportName)
	var	j=0	
	var repRows=t.rows.length
	/*
	for ( j=0;j<=repRows-1;j++){
		if (t.rows(j).cells.length>MaxCols)
		{
			MaxCols=t.rows(j).cells.length
			Maxj=j			
		}		
	}
	*/
	var oXmlcol=new ActiveXObject("Microsoft.XMLDOM")
	oXmlcol.async =false
	oXmlcol.loadXML ("<root>"+SetColWidth+"</root>");
	var colLength=oXmlcol.documentElement.childNodes.length
	MaxCols=t.childNodes(0).childNodes.length
	if (MaxCols!=colLength){
		alert("列初始化不正确，请重新设置！")
		self.close ()
		var err="Error"
		return err
	}
	else {
		if (colwidthXML==""){		
			SaveUserData("setcolwidth","ReportColWidth"+ReportName,SetColWidth)	
		}
	}
	var formatXML=LoadUserData("setformat","Format"+ReportName)
	
	if (formatXML=="" || changeUserDate==true){
		var strTemp="";
		
		strTemp="<root>"+"<selIndex>3</selIndex>"+
		"<repWidth>"+prnSet.repWidth+"</repWidth>"+"<repHeight>"+prnSet.repHeight+"</repHeight>"+
		"<portrait>"+prnSet.portrait +"</portrait>"+"<level>"+prnSet.level+"</level>"+
		"<CaptionTop>22</CaptionTop>"+"<CaptionBottom>22</CaptionBottom>"+
		"<tabTop>"+tabTop+"</tabTop>"+"<tabBottom>"+tabBottom+"</tabBottom>"+
		"<tabLeft>"+tabLeft+"</tabLeft>"+"<tabRight>"+tabRight+"</tabRight>"+				
		"<tabHead>"+tabHead+"</tabHead>"+"<tabCauda>"+tabCauda+"</tabCauda>"+
		"<topOffset>"+topOffset+"</topOffset>"+"<leftOffset>"+leftOffset+"</leftOffset>"+"<coverPrint>"+coverPrint+"</coverPrint>"+"<AutoturnRow>"+AutoturnRow+"</AutoturnRow>"+
		"<imgsrc>"+imgsrc+"</imgsrc>"+"<imgshow>"+imgshow+"</imgshow>"+"<imgLeft>"+imgLeft+"</imgLeft>"+"<imgTop>"+imgTop+"</imgTop>"
		+"<compressWidth>"+prnSet.compressWidth+"</compressWidth>"
		+"<compressHeight>"+prnSet.compressHeight+"</compressHeight>"
		+"<compressFont>"+prnSet.compressFont+"</compressFont>"
		+"<compressPrint>"+prnSet.compressPrint+"</compressPrint>"
		+"<offsetAdjust>"+prnSet.offsetAdjust +"</offsetAdjust>"
		+"<titleheight>"+prnSet.titleheight +"</titleheight>"
		+"</root>"

		SaveUserData("setformat","Format"+ReportName,strTemp)
	
	}
	var repHead=LoadUserData("appendInfo","appendInfo"+ReportName)
	 
	if (repHead=="" || changeUserDate==true ){
		var head="<root>"+"<title1>"+title1+"</title1>"+"<title2>"+title2+"</title2>"+"<top11>"+top11+"</top11>"
		+"<top12>"+top12+"</top12>"+"<top13>"+top13+"</top13>"+"<top21>"+top21+"</top21>"+"<top22>"+top22+"</top22>"
		+"<top23>"+top23+"</top23>"+"<top31>"+top31+"</top31>"+"<top32>"+top32+"</top32>"+"<top33>"+top33+"</top33>"
		+"<bottom11>"+bottom11+"</bottom11>"+bottom12+"<bottom12>"+"</bottom12>"+"<bottom13>"+bottom13+"</bottom13>"
		+"<bottom21>"+bottom21+"</bottom21>"+"<bottom22>"+bottom22+"</bottom22>"+"<bottom23>"+bottom23+"</bottom23>"
		+"<bottom31>"+bottom31+"</bottom31>"+"<bottom32>"+bottom32+"</bottom32>"+"<bottom33>"+bottom33+"</bottom33>"
		+"<fontTop>"+fontTop+"</fontTop>"+"<fontBottom>"+fontBottom+"</fontBottom>"+"</root>"
	
		SaveUserData("appendInfo","appendInfo"+ReportName,head)
	}
}

function getformat(){
	var formatXML=LoadUserData("setformat","Format"+ReportName)
	var oXML2=new ActiveXObject("Microsoft.XMLDOM")
	oXML2.async =false
	oXML2.loadXML (formatXML);
	try {
		var stmp1=parseInt(oXML2.documentElement.childNodes.item(21).text)  
		var stmp2=parseInt(oXML2.documentElement.childNodes.item(22).text)  
		var stmp3=parseInt(oXML2.documentElement.childNodes.item(23).text)  
		var stmp4=parseInt(oXML2.documentElement.childNodes.item(24).text)  
		var stmp5=parseInt(oXML2.documentElement.childNodes.item(25).text)  
		prnSet.compressWidth=stmp1
		prnSet.compressHeight=stmp2
		prnSet.compressFont=stmp3
		prnSet.compressPrint=stmp4
		prnSet.offsetAdjust=stmp5
		pxRatemm=3.78*(297-stmp5)/297
	}
	catch (e){}

	repWidth=parseFloat(oXML2.documentElement.childNodes.item(1).text)*pxRatemm	
	repHeight=parseFloat(oXML2.documentElement.childNodes.item(2).text)*pxRatemm	
	portrait=oXML2.documentElement.childNodes.item(3).text
	prnSet.portrait=portrait
	level=oXML2.documentElement.childNodes.item(4).text
	prnSet.level=level
	CaptionTop=parseInt(oXML2.documentElement.childNodes.item(5).text)
	CaptionBottom=parseInt(oXML2.documentElement.childNodes.item(6).text)
	tabTop=parseInt(oXML2.documentElement.childNodes.item(7).text)*pxRatemm
	prnSet.tabTop=oXML2.documentElement.childNodes.item(7).text
	tabBottom=parseInt(oXML2.documentElement.childNodes.item(8).text)*pxRatemm
	prnSet.tabBottom=oXML2.documentElement.childNodes.item(8).text
	tabLeft=parseInt(oXML2.documentElement.childNodes.item(9).text)*pxRatemm
	prnSet.tabLeft=oXML2.documentElement.childNodes.item(9).text
	tabRight=parseInt(oXML2.documentElement.childNodes.item(10).text)*pxRatemm
	prnSet.tabRight=oXML2.documentElement.childNodes.item(10).text
	tabHead=parseInt(oXML2.documentElement.childNodes.item(11).text)
	prnSet.tabHead=tabHead
	tabCauda=parseInt(oXML2.documentElement.childNodes.item(12).text)
	prnSet.tabCauda=tabCauda
	topOffset=parseInt(oXML2.documentElement.childNodes.item(13).text)*pxRatemm
	prnSet.topOffset=oXML2.documentElement.childNodes.item(13).text
	leftOffset=parseInt(oXML2.documentElement.childNodes.item(14).text)*pxRatemm
	prnSet.leftOffset=oXML2.documentElement.childNodes.item(14).text
	coverPrint=oXML2.documentElement.childNodes.item(15).text
	prnSet.coverPrint=coverPrint
	AutoturnRow=oXML2.documentElement.childNodes.item(16).text
	prnSet.AutoturnRow=AutoturnRow
	imgsrc=oXML2.documentElement.childNodes.item(17).text
	prnSet.imgsrc=imgsrc
	imgshow=oXML2.documentElement.childNodes.item(18).text
	prnSet.imgshow=imgshow
	imgLeft=parseInt(oXML2.documentElement.childNodes.item(19).text)*pxRatemm
	prnSet.imgLeft=oXML2.documentElement.childNodes.item(19).text
	imgTop=parseInt(oXML2.documentElement.childNodes.item(20).text)*pxRatemm
	prnSet.imgTop=oXML2.documentElement.childNodes.item(20).text
	if (t.style.fontSize==""){
		t.style.fontSize=15
	}
	if (coverPrint=="true"){
		t.border=0
	}
	if (portrait=="false" ){
		var bTran=repWidth
		repWidth=repHeight
		repHeight=bTran
	}		
	prnSet.repWidth=oXML2.documentElement.childNodes.item(1).text
	prnSet.repHeight=oXML2.documentElement.childNodes.item(2).text

}
function getcolwidth(){
	var colwidthXML=LoadUserData("setcolwidth","ReportColWidth"+ReportName)
	var	j=0	
	var repRows=t.rows.length
	/*
	for ( j=0;j<=repRows-1;j++){
		if (t.rows(j).cells.length>MaxCols)
		{
			MaxCols=t.rows(j).cells.length
			Maxj=j			
		}		
	}
	*/
	MaxCols=t.childNodes(0).childNodes.length
	var i=MaxCols    
	var colwidthXML=LoadUserData("setcolwidth","ReportColWidth"+ReportName)
	var oXML1=new ActiveXObject("Microsoft.XMLDOM")
	oXML1.async="false";
	oXML1.loadXML("<root>" +colwidthXML+"</root>")	
    iBound=oXML1.documentElement.childNodes.length
	if (MaxCols!=iBound){
		alert("缓存中的列数和此报表的列数不相等，请重新设置列宽！")
	}
	else {
		for (i=0;i<=MaxCols-1;i++){		
			strCol=strCol+"<col style='display:"+oXML1.documentElement.childNodes.item(i).getAttribute("colSelect")+"'"+" width='"+oXML1.documentElement.childNodes.item(i).getAttribute("colWidth")+"' />"
	    }
	    strCol=strCol+"</COLGROUP>"
		for (var i=0;i<=iBound-1;i++){			
			if (oXML1.documentElement.childNodes.item(i).getAttribute("colSelect")=="block"){
				allWidth=allWidth+parseInt(oXML1.documentElement.childNodes.item(i).getAttribute("colWidth"))//计算主表格的总宽都度
			}
		}
	}
}
function getappendInfo(){
	var appendinfoXML=LoadUserData("appendInfo","appendInfo"+ReportName)
	if (appendinfoXML!=""){
		var oXML3=new ActiveXObject("Microsoft.XMLDOM");
		oXML3.async="false";
		oXML3.loadXML(appendinfoXML);
		var NodeLength=oXML3.documentElement .childNodes .length
		var topFind=false
		for (var i=0;i<=10;i++){
			if (topFind==false){
				if (oXML3.documentElement.childNodes(i).text==""){
					repTop.style.display="none"
					topFind=true
				}
			}
			else {
				repTop.style.display="block"
			}
		}
				
		var bottomFind=false
		for (var j=11;j<20;j++){
			if (bottomFind==false){
				if (oXML3.documentElement.childNodes(j).text==""){
					repBottom.style.display="none"
					bottomFind=true
				}
			}
			else {
				repBottom.style.display="block"
			}
		}
		repTop.rows(0).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(0).xml)
		repTop.rows(1).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(1).xml)
		try {
			repTop.rows(1).style.height=prnSet.titleheight
		}
		catch (e) {}
		
		repTop.rows(2).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(2).xml)
		repTop.rows(2).cells(1).innerHTML=(oXML3.documentElement.childNodes.item(3).xml)
		repTop.rows(2).cells(2).innerHTML=(oXML3.documentElement.childNodes.item(4).xml)
		repTop.rows(3).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(5).xml)
		repTop.rows(3).cells(1).innerHTML=(oXML3.documentElement.childNodes.item(6).xml)
		repTop.rows(3).cells(2).innerHTML=(oXML3.documentElement.childNodes.item(7).xml)
		repTop.rows(4).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(8).xml)
		repTop.rows(4).cells(1).innerHTML=(oXML3.documentElement.childNodes.item(9).xml)
		repTop.rows(4).cells(2).innerHTML=(oXML3.documentElement.childNodes.item(10).xml)
		//////////////////////////////////////////////////////////////////////////////////
		repBottom.rows(0).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(11).xml)
		repBottom.rows(0).cells(1).innerHTML=(oXML3.documentElement.childNodes.item(12).xml)
		repBottom.rows(0).cells(2).innerHTML=(oXML3.documentElement.childNodes.item(13).xml)
		repBottom.rows(1).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(14).xml)
		repBottom.rows(1).cells(1).innerHTML=(oXML3.documentElement.childNodes.item(15).xml)
		repBottom.rows(1).cells(2).innerHTML=(oXML3.documentElement.childNodes.item(16).xml)
		repBottom.rows(2).cells(0).innerHTML=(oXML3.documentElement.childNodes.item(17).xml)
		repBottom.rows(2).cells(1).innerHTML=(oXML3.documentElement.childNodes.item(18).xml)
		repBottom.rows(2).cells(2).innerHTML=(oXML3.documentElement.childNodes.item(19).xml)
		fontTop=parseInt(oXML3.documentElement.childNodes.item(20).text)   
		fontBottom=parseInt(oXML3.documentElement.childNodes.item(21).text)	
		prnSet.title1=oXML3.documentElement.childNodes.item(0).text
		prnSet.title2=oXML3.documentElement.childNodes.item(1).text
		prnSet.top11=oXML3.documentElement.childNodes.item(2).text
		prnSet.top12=oXML3.documentElement.childNodes.item(3).text
		prnSet.top13=oXML3.documentElement.childNodes.item(4).text
		prnSet.top21=oXML3.documentElement.childNodes.item(5).text
		prnSet.top22=oXML3.documentElement.childNodes.item(6).text
		prnSet.top23=oXML3.documentElement.childNodes.item(7).text
		prnSet.top31=oXML3.documentElement.childNodes.item(8).text
		prnSet.top32=oXML3.documentElement.childNodes.item(9).text
		prnSet.top33=oXML3.documentElement.childNodes.item(10).text
		prnSet.bottom11=oXML3.documentElement.childNodes.item(11).text
		prnSet.bottom12=oXML3.documentElement.childNodes.item(12).text
		prnSet.bottom13=oXML3.documentElement.childNodes.item(13).text
		prnSet.bottom21=oXML3.documentElement.childNodes.item(14).text
		prnSet.bottom22=oXML3.documentElement.childNodes.item(15).text
		prnSet.bottom23=oXML3.documentElement.childNodes.item(16).text
		prnSet.bottom31=oXML3.documentElement.childNodes.item(17).text
		prnSet.bottom32=oXML3.documentElement.childNodes.item(18).text
		prnSet.bottom33=oXML3.documentElement.childNodes.item(19).text
		prnSet.fontTop=parseInt(oXML3.documentElement.childNodes.item(20).text)
		prnSet.fontBottom=parseInt(oXML3.documentElement.childNodes.item(21).text)

		repTop.rows(0).style.fontSize=fontTop
		repTop.rows(1).style.fontSize=fontTop*0.7   
		repTop.rows(2).style.fontSize=fontBottom
		repTop.rows(3).style.fontSize=fontBottom
		repTop.rows(4).style.fontSize=fontBottom
		repBottom.style.fontSize=fontBottom
				
		if (allWidth<repWidth-tabLeft-tabRight){
			repTop.style.width=allWidth//repWidth-tabLeft-tabRight
			repBottom.style.width=allWidth
		}
		else {
			repTop.style.width=repWidth-tabLeft-tabRight
			repBottom.style.width=repWidth-tabLeft-tabRight
		}
		repTop.style.height=repTop.offsetHeight				
		repBottom.style.height=repBottom.offsetHeight
		heightTop=parseInt(repTop.style.height) 
		heightBottom=parseInt(repBottom.style.height)
	}
		
	htmlTop=repTop.outerHTML
	htmlBottom=repBottom.outerHTML
}
function setAutoturnRow(){
	if (AutoturnRow=="false"){
		var littlerowsHeight=500;
		for (var i=0;i<t.rows.length;i++){
			if(littlerowsHeight>=parseInt(t.rows(i).offsetHeight )){
				littlerowsHeight=parseInt(t.rows(i).offsetHeight)
			}			
		}	
		for (var i=0;i<t.rows.length;i++){
			t.rows(i).style.height=littlerowsHeight
		}
		
	}
	else {
		for (var i=0;i<t.rows.length;i++){		
			t.rows(i).style.height=t.rows(i).offsetHeight
		}
	}
	
	for (var i=0;i<tabHead;i++){
		PageHeadHTML=PageHeadHTML+t.rows(i).outerHTML//+"</TR>"
		PageHeadHeight=PageHeadHeight+t.rows(i).offsetHeight
	}
	for (var j=parseInt(t.rows.length)-tabCauda;j<t.rows.length;j++){
		PageCaudaHTML=PageCaudaHTML+t.rows(j).outerHTML
		PageCaudaHeight=PageCaudaHeight+t.rows(j).offsetHeight
	}
	tabstyle=t.outerHTML.substring(t.outerHTML.indexOf("<"),t.outerHTML.indexOf(">")+1);
		
	tabstyle=tabstyle.toUpperCase();
	tabstyle=replaceString(tabstyle,"ID=T","")
	t.style.display="none"
}
function HideCol(Source,iStart,iEnd){
	var oX=new ActiveXObject("Microsoft.XMLDOM")
	oX.async="false";
	oX.loadXML(Source)
	for (var i=0;i<oX.documentElement .childNodes .length ;i++ ){
		if (i<iStart || i>iEnd){
			oX.documentElement .childNodes.item (i).setAttribute("style","display:none");			
		}	
	}	
	return oX.documentElement .xml 
}
function compressColWidth(dblRate) {
	var oX=new ActiveXObject("Microsoft.XMLDOM");
	oX.async="false";
	oX.loadXML(strCol);
	for (var i=0;i<oX.documentElement .childNodes .length ;i++ ){
		var d1=parseInt(oX.documentElement.childNodes.item(i).getAttribute("width"))*dblRate	;
		oX.documentElement .childNodes.item (i).setAttribute("width",d1);
	}
	strCol=oX.documentElement.xml 
}
function compressRowHeight(dblRate,tabHead,lngEndLine) {
	for (var i=tabHead;i<lngEndLine;i++)
	{	
		t.rows(i).style.height=parseInt(t.rows(i).offsetHeight)*dblRate;
	}
}
function window_onload(){

	tipPrint.style.display="none"
	userData=oForm.oInput

	cboZoom.left=330
	cboZoom.top=5
	cboZoom.width=70
	cboZoom.format="比例!"
	cboZoom.xml="500%;200%;150%;100%;75%;50%;25%;10%"

	var lngPageMargin=20 
	init()
	instantiationPage()
	if(prnSet.inPrint==1) {
		window.print()
		self.close();
	}
	toolbar.visibility="visible"

}
function instantiationPage(){
	screenWidth=window.screen .width ;
	screenHeight=window.screen .height;	
	biglabel.style.width =screenWidth-5;
	biglabel.style .height =screenHeight-50;
	biglabel.style .overflow ="auto";
	try {
		biglabel.style.zoom="100%"
	}
	catch (e) {}	
	cboZoom.value="100%"

	curTD.innerText ="共"+Pages+"页" 
	newdivnum=biglabel.childNodes .length;
	repTop.style.display="none"
	repBottom.style.display="none"
	for (var i=1;i<=newdivnum;i++){
		biglabel.childNodes (i-1).innerHTML=unescape(arrPage[i-1])
		var sDisplay=""
		var sDisplay1=""
		if(leftOffset>0) sDisplay=";display:block;"
		if(topOffset>0) sDisplay1=";display:block;"
		var sMargin="<span id=spanLeft class=pagemargin style='left:0;top:0;height:"+repHeight+";width:"+leftOffset+sDisplay+"'></span>"
		+"<span id=spanTop class=pagemargin style='left:0;top:0;width:"+repWidth+";height:"+topOffset+sDisplay1+"'></span>"
		+"<span id=spanRight class=pagemargin style='left:"+(repWidth-rightOffset)+";top:0;height:"+repHeight+";width:"+rightOffset+"'></span>"
		+"<span id=spanBottom class=pagemargin  style='left:0;top:"+(repHeight-bottomOffset)+";width:"+repWidth+";height:"+bottomOffset+"'></span>"
		biglabel.childNodes (i-1).innerHTML=biglabel.childNodes (i-1).innerHTML+sMargin
		
		biglabel.childNodes (i-1).style.position="absolute"
		biglabel.childNodes (i-1).style.height=repHeight;
		biglabel.childNodes (i-1).style.width=repWidth;
		biglabel.childNodes (i-1).childNodes(0).style.left=tabLeft
		biglabel.childNodes (i-1).childNodes(0).style.top=tabTop
		//biglabel.childNodes (i-1).childNodes(0).style.width=biglabel.childNodes (i-1).childNodes(2).offsetWidth
		biglabel.childNodes (i-1).childNodes(1).style.top=tabTop+heightTop+parseInt(biglabel.childNodes (i-1).childNodes(2).offsetHeight)//附加信息下面表格的Top
		biglabel.childNodes (i-1).childNodes(1).style.left=tabLeft
		//biglabel.childNodes (i-1).childNodes(1).style.width=biglabel.childNodes (i-1).childNodes(2).offsetWidth
		biglabel.childNodes (i-1).childNodes(2).style.left=tabLeft;
		biglabel.childNodes (i-1).childNodes(2).style.top=tabTop+heightTop
		
		
		biglabel.childNodes (i-1).childNodes(3).style.zIndex=-1
		biglabel.childNodes (i-1).childNodes(3).style.position="absolute"
		if (imgsrc==""){
			biglabel.childNodes (i-1).childNodes(3).style.display="none"
		}
		else {
			if (imgshow=="true"){	
				biglabel.childNodes (i-1).childNodes(3).src=imgsrc	
				biglabel.childNodes (i-1).childNodes(3).style.top=imgTop
				biglabel.childNodes (i-1).childNodes(3).style.left=imgLeft
				biglabel.childNodes (i-1).childNodes(3).style.height=biglabel.childNodes (i-1).childNodes(3).offsetHeight
				biglabel.childNodes (i-1).childNodes(3).style.width=biglabel.childNodes (i-1).childNodes(3).offsetWidth
			}
			else {
				biglabel.childNodes (i-1).childNodes(3).style.display="none"
			}
		}
		biglabel.childNodes (i-1).style.top=(i-1)*repHeight+i*lngPageMargin//perPageHeight+20
		if ((screenWidth-repWidth-9)>0){
			biglabel.childNodes (i-1).style.left=(screenWidth-repWidth-9)/2
		}
		else {
			biglabel.childNodes (i-1).style.left=0
		}
		
	}	
	
	allPageHTML=biglabel.innerHTML 
	

}
function getVersion() {
	var sVer=navigator.appVersion
	var l=sVer.indexOf("MSIE")
	sVer=sVer.substring(l+5,l+8)
	var dbl=parseFloat(sVer)
	if(isNaN(dbl))
		return 0
	else
		return dbl
		
}
///////
function cboZoom_onchange() {
	if (cboZoom.value=="比例") cboZoom.value="100%"

	if(getVersion()>=5.5) {
		biglabel.style.zoom=trim(cboZoom.value)+"%"
		biglabel.style.width =(screen.width-5)*100/parseInt(cboZoom.value)
		biglabel.style.height =(screen.height-50)*100/parseInt(cboZoom.value)
		return
	}
	if (allWidth<effectiveWidth){
		effectiveWidth=allWidth
	}

	var dblRate=parseInt(trim(cboZoom.value))/100 

	biglabel.innerHTML =allPageHTML				
	var newdivnum=biglabel.childNodes .length;
	for (var i=1;i<=newdivnum;i++){				
		biglabel.childNodes (i-1).style.position="absolute"
		biglabel.childNodes (i-1).style.height=repHeight*dblRate;
		biglabel.childNodes (i-1).style.width=repWidth*dblRate;
		biglabel.childNodes (i-1).childNodes(0).style.left=tabLeft*dblRate;
		biglabel.childNodes (i-1).style.top=(i-1)*repHeight*dblRate+i*lngPageMargin
		biglabel.childNodes (i-1).childNodes(0).style.top=tabTop*dblRate
		biglabel.childNodes (i-1).childNodes(0).rows(0).style.fontSize=fontTop*dblRate
		biglabel.childNodes (i-1).childNodes(0).rows(1).style.fontSize=fontTop*0.7*dblRate 
		biglabel.childNodes (i-1).childNodes(0).rows(2).style.fontSize=fontBottom*dblRate
		biglabel.childNodes (i-1).childNodes(0).rows(3).style.fontSize=fontBottom*dblRate
		biglabel.childNodes (i-1).childNodes(0).rows(4).style.fontSize=fontBottom*dblRate
		
		biglabel.childNodes (i-1).childNodes(0).style.height=parseInt(biglabel.childNodes (i-1).childNodes(0).offsetHeight)*dblRate
		biglabel.childNodes (i-1).childNodes(0).style.width=effectiveWidth*dblRate
		biglabel.childNodes (i-1).childNodes(1).style.left=tabLeft*dblRate
		biglabel.childNodes (i-1).childNodes(1).style.top=parseInt(biglabel.childNodes (i-1).childNodes(0).offsetHeight)+tabTop*dblRate+parseInt(biglabel.childNodes (i-1).childNodes(2).offsetHeight)
		biglabel.childNodes (i-1).childNodes(1).style.fontSize=parseInt(biglabel.childNodes (i-1).childNodes(1).style.fontSize)*dblRate
		biglabel.childNodes (i-1).childNodes(1).style.height=parseInt(biglabel.childNodes (i-1).childNodes(1).style.height)*dblRate
		biglabel.childNodes (i-1).childNodes(1).style.width=effectiveWidth*dblRate
		biglabel.childNodes (i-1).childNodes(2).style.fontSize=parseInt(biglabel.childNodes (i-1).childNodes(2).style.fontSize)*dblRate
		biglabel.childNodes (i-1).childNodes(2).style.top=parseInt(biglabel.childNodes (i-1).childNodes(0).offsetHeight)+tabTop*dblRate
		biglabel.childNodes (i-1).childNodes(2).style.left=tabLeft*dblRate
		if ((screenWidth-repWidth*dblRate-9)>0){
			biglabel.childNodes (i-1).style.left=(screenWidth-repWidth*dblRate-9)/2
		}
		else {
			biglabel.childNodes (i-1).style.left=0
		}
		var tabrows=parseInt(biglabel.childNodes (i-1).childNodes(2).rows.length)	
		for (var j=0;j<tabrows;j++){
			biglabel.childNodes(i-1).childNodes(2).rows(j).style.height=biglabel.childNodes (i-1).childNodes(2).rows(j).offsetHeight*dblRate
		}
		var tabcols=parseInt(biglabel.childNodes (i-1).childNodes(2).childNodes(0).childNodes.length)
		for (var j=0;j<tabcols;j++){
			biglabel.childNodes (i-1).childNodes(2).childNodes(0).childNodes(j).style.width=biglabel.childNodes (i-1).childNodes(2).childNodes(0).childNodes(j).offsetWidth*dblRate
		
		}	

		if (biglabel.childNodes (i-1).childNodes(3).style.display!="none"){	
			biglabel.childNodes (i-1).childNodes(3).style.top=parseInt(imgTop)*dblRate
			biglabel.childNodes (i-1).childNodes(3).style.left=parseInt(imgLeft)*dblRate
			biglabel.childNodes (i-1).childNodes(3).style.height=parseInt(biglabel.childNodes (i-1).childNodes(3).style.height)*dblRate
			biglabel.childNodes (i-1).childNodes(3).style.width=parseInt(biglabel.childNodes (i-1).childNodes(3).style.width)*dblRate
		}
		biglabel.childNodes (i-1).childNodes(4).style.height=biglabel.childNodes (i-1).childNodes(4).style.pixelHeight*dblRate
		biglabel.childNodes (i-1).childNodes(4).style.width=biglabel.childNodes (i-1).childNodes(4).style.pixelWidth*dblRate
		biglabel.childNodes (i-1).childNodes(5).style.height=biglabel.childNodes (i-1).childNodes(5).style.pixelHeight*dblRate
		biglabel.childNodes (i-1).childNodes(5).style.width=biglabel.childNodes (i-1).childNodes(5).style.pixelWidth*dblRate
		biglabel.childNodes (i-1).childNodes(6).style.height=biglabel.childNodes (i-1).childNodes(6).style.pixelHeight*dblRate
		biglabel.childNodes (i-1).childNodes(6).style.width=biglabel.childNodes (i-1).childNodes(6).style.pixelWidth*dblRate
		biglabel.childNodes (i-1).childNodes(7).style.height=biglabel.childNodes (i-1).childNodes(7).style.pixelHeight*dblRate
		biglabel.childNodes (i-1).childNodes(7).style.width=biglabel.childNodes (i-1).childNodes(7).style.pixelWidth*dblRate
	
	}			
				
}

function window_onbeforeprint() {
	//在非1:1预览的情况下打印应恢复1:1
	var dblRate=parseInt(trim(cboZoom.value))/100 //数值型比例
	if(dblRate!=1) {
		cboZoom.value="100%"
		cboZoom_onchange()
	}
	//-------------------
//	alert("window_onbeforeprint")
	toolbar.style.display ="none"
	cboZoom.visible=false
	tipPrint.style.display="none"
	
	//biglabel.style.overflow ="hidden"
	//biglabel.style.overflowX="hidden"
	biglabel.style.overflow ="";
	
	var newdivnum=biglabel.childNodes.length;//新建div的个数
	
	biglabel.style.height ="" //repHeight*newdivnum;
	biglabel.style.width=""	//repWidth+leftOffset
	biglabel.style.position=""
	
	for (var i=1;i<=newdivnum;i++){				
		biglabel.childNodes (i-1).style.position="absolute"					
		biglabel.childNodes (i-1).style.borderTopWidth=0;	
		biglabel.childNodes (i-1).style.borderLeftWidth=0;
		biglabel.childNodes (i-1).style.borderRightWidth=0;
		biglabel.childNodes (i-1).style.borderBottomWidth=0;
		biglabel.childNodes (i-1).style.left=-leftOffset
		//biglabel.childNodes (i-1).style.width=parseInt(biglabel.childNodes (i-1).style.width)+leftOffset
		biglabel.childNodes (i-1).style.top=(i-1)*repHeight-topOffset
		
		biglabel.childNodes (i-1).style.width=""
		biglabel.childNodes (i-1).style.height=""
		biglabel.childNodes (i-1).className=""
		//隐藏掉页边距,以免多打印出空白页
		var ospan
		if(newdivnum==1) {
			ospan=spanLeft
			ospan.style.display="none"
			ospan=spanRight
			ospan.style.display="none"
			ospan=spanTop
			ospan.style.display="none"
			ospan=spanBottom
			ospan.style.display="none"
		}
		else {
			ospan=spanLeft[i-1]
			ospan.style.display="none"
			ospan=spanRight[i-1]
			ospan.style.display="none"
			ospan=spanTop[i-1]
			ospan.style.display="none"
			ospan=spanBottom[i-1]
			ospan.style.display="none"
		}
		
	}
	//sdafds
	return
}

function window_onafterprint() {
	toolbar.style.display ="block"
	cboZoom.visible=true
	
	biglabel.style .overflow ="auto";
	
	var newdivnum=biglabel.childNodes.length;//新建div的个数
	
	biglabel.style.width =(screen.width-5)*100/parseInt(cboZoom.value)
	biglabel.style.height =(screen.height-50)*100/parseInt(cboZoom.value)
	biglabel.style.position="absolute"
	
	for (var i=1;i<=newdivnum;i++){				
		biglabel.childNodes (i-1).style.position="absolute"					
		biglabel.childNodes (i-1).style.borderTopWidth=2;	
		biglabel.childNodes (i-1).style.borderLeftWidth=2;
		biglabel.childNodes (i-1).style.borderRightWidth=2;
		biglabel.childNodes (i-1).style.borderBottomWidth=2;
		biglabel.childNodes (i-1).style.width=repWidth
		biglabel.childNodes (i-1).style.height=repHeight
		
		biglabel.childNodes (i-1).style.top=(i-1)*repHeight+i*lngPageMargin
		if ((screenWidth-repWidth-9)>0){
			biglabel.childNodes (i-1).style.left=(screenWidth-repWidth-9)/2
		}
		else {
			biglabel.childNodes (i-1).style.left=0
		}

		biglabel.childNodes (i-1).className="previewDiv"
		//隐藏掉页边距,以免多打印出空白页
		var ospan
		if(newdivnum==1) {
			ospan=spanLeft
			ospan.style.display="block"
			ospan=spanRight
			ospan.style.display="block"
			ospan=spanTop
			ospan.style.display="block"
			ospan=spanBottom
			ospan.style.display="block"
		}
		else {
			ospan=spanLeft[i-1]
			ospan.style.display="block"
			ospan=spanRight[i-1]
			ospan.style.display="block"
			ospan=spanTop[i-1]
			ospan.style.display="block"
			ospan=spanBottom[i-1]
			ospan.style.display="block"
		}
		
	}
	//sdafds
	return

}

function cmdPrint_onclick() {
	window.print()
}

function setappendinfo_onclick() {
	var arySend=new Array()
	arySend[0]=userData
	arySend[1]=ReportName
	var	formatReturn=window.showModalDialog("wphead.htm",arySend,"dialogHeight:500px;dialogWidth:530px;dialogTop:50;dialogLeft:200px;status:no")
	if (formatReturn)
		refreshPage()

}

function setcolwidth_onclick() {
}
function setpageface_onclick(){

	var winWidth=400
	var winHeight=520
		
	var RepFormat=LoadUserData("setformat","Format"+ReportName)
	
	if (RepFormat!=""){
		var oXML1=new ActiveXObject("Microsoft.XMLDOM")
		oXML1.async="false";
		oXML1.loadXML(RepFormat)
		var imgsrc3=oXML1.documentElement.childNodes.item(17).text
		if (imgsrc3==""){			
			winWidth=400
			winHeight=450
		}
	}
	var formatReturn =new Array()	
	var arySend=new Array(6)  
	arySend[0]=t.style.top
	arySend[1]=t.style.left
	arySend[2]=t.style.fontSize
	arySend[3]=ReportName
//	for (var i=0;i<=t.rows.length-1;i++){
//		arySend[4]=t.rows(i).style.height
//	}
	arySend[5]=t
	arySend[6]=userData

	arySend[7]=prnSet.repWidth
	arySend[8]=prnSet.repHeight
	
 	var setWin="dialogHeight:"+winHeight+"px;dialogWidth:"+winWidth+"px;dialogTop:70px;dialogLeft:200px;status:no"
 
	formatReturn=window.showModalDialog("wpformat.htm",arySend,setWin) 
	if (formatReturn)
		refreshPage()

}
///////////////////////////////////

function MergeInfo(row,col,rowSpan,colSpan) {
	this.row=row
	this.col=col
	this.rowSpan=rowSpan
	this.colSpan=colSpan
}
function sumMerge() {
	var maxCols=0
	for (var j=0;j<t.rows(0).cells.length ;j++) {
		var lngCols=parseInt(t.rows(0).cells(j).colSpan)
		maxCols=maxCols+lngCols
	}
	var curTab=t.innerHTML 
	var arr=new Array()
	
	var rowAdd=0
	var colAdd=0
	var ii=0
	for (var i=0;i<t.rows.length ;i++) {
		colAdd=0
		for (var j=0;j<t.rows(i).cells.length ;j++) {
			var curTD=t.rows(i).cells(j)
			
			var lngRows=parseInt(curTD.rowSpan)
			if (isNaN(lngRows))lngRows=0
			var lngCols=parseInt(curTD.colSpan)
			if (isNaN(lngCols))lngCols=0
			if (lngRows>1 || lngCols>1) {
				arr[ii]=new MergeInfo(i,j,lngRows,lngCols)
				ii++
				for (var iii=0;iii<=lngRows-1;iii++) {
					for (var jjj=0;jjj<=lngCols-1;jjj++) {
						if (iii!=0 || jjj!=0)  {
							if (j>=t.rows(i+iii).cells.length)
								t.rows(i+iii).insertCell()
							else
								t.rows(i+iii).insertCell(j)
						}
					}
				}
				curTD.rowSpan=1
				curTD.colSpan=1
			}
	
		}
	}
	for (var i=0;i<arr.length;i++) {
		oRectXml=oRectXml+"<record><row0>"+arr[i].row+"</row0><col0>"+arr[i].col+"</col0>" 
		+"<row1>"+(arr[i].row+arr[i].rowSpan-1)+"</row1><col1>"+(arr[i].col+arr[i].colSpan-1)+"</col1></record>"
	}
	
	oRectXml=oRectXml+"</root>"
	
	if (oRectXml=="<root></root>") {
		oCoorXml="<root></root>"
		return
	}
	
	var oXml=new ActiveXObject("Microsoft.XMLDOM")
	oXml.async="false";
	oXml.loadXML(oRectXml)
	var minRow=parseInt(oXml.documentElement.childNodes.item(0).childNodes.item(0).text) 
	var maxRow=parseInt(oXml.documentElement.childNodes.item(oXml.documentElement.childNodes.length-1).childNodes.item(2).text) 
	
	
	for (var i=minRow;i<=maxRow ;i++ ) {
		var oFind=oXml.documentElement.selectNodes("//record[row0<=" + i + " and row1>=" + i + "]")
		if (oFind.length>0) {
			coljTd=0
			colAdd=0
			
			
			var preColNo=-1
			for (var j=0;j<maxCols ;j++ ) {
				var bFind=0 
				for(var k=0;k<oFind.length;k++) {
					if (j>parseInt(oFind.item(k).childNodes.item(1).text) && j<=parseInt(oFind.item(k).childNodes.item(3).text)) {
						coljTd=preColNo
						bFind=2 
						break
					}
					if (j==parseInt(oFind.item(k).childNodes.item(1).text) ) {
						if (oFind.item(k).childNodes.item(0).text==i+"") {
						 coljTd=preColNo+1
						}
						else {
						 coljTd=preColNo
						} 
						bFind=1 
						break
					}
				}
				
				if (bFind==0) {	
					coljTd=preColNo+1//j-colAdd
				}
				oCoorXml=oCoorXml+"<record><row>"+i+"</row><col>"+j+"</col>" 
				+"<coltd>"+coljTd+"</coltd></record>"
				
				preColNo=coljTd
			}
		}
	}
	oCoorXml=oCoorXml+"</root>"

}

function close_onclick(){	
	self.close ()
}
function cboZoom_onkeypress() {
	if(event.keyCode ==13) { 
		var tmp1=parseInt(trim(cboZoom.value))
		if (tmp1>=10 && tmp1<=500) {
			cboZoom_onchange()
		}
		else {
			alert("放缩比例应在10%到500%之间.")
		}
	}
}
var htmlToptmp=""
var htmlTopBottom=""
function PageDataAdd(curPage) {
<%
    Date now = new Date();
    SimpleDateFormat yyyy = new SimpleDateFormat("yyyy");
    SimpleDateFormat MM = new SimpleDateFormat("MM");
    SimpleDateFormat dd = new SimpleDateFormat("dd");
    SimpleDateFormat hh = new SimpleDateFormat("kk");
    SimpleDateFormat mm = new SimpleDateFormat("mm");
    SimpleDateFormat ss = new SimpleDateFormat("ss");
%>
	curPage++ ;
	htmlTop=fc_RepStr(htmlToptmp,"(p)",curPage+"");
    htmlTop=fc_RepStr(htmlTop,"(yyyy)","<%= yyyy.format(now)%>");
    htmlTop=fc_RepStr(htmlTop,"(MM)","<%= MM.format(now)%>");
    htmlTop=fc_RepStr(htmlTop,"(dd)","<%= dd.format(now)%>");
    htmlTop=fc_RepStr(htmlTop,"(hh)","<%= hh.format(now)%>");
    htmlTop=fc_RepStr(htmlTop,"(mm)","<%= mm.format(now)%>");
    htmlTop=fc_RepStr(htmlTop,"(ss)","<%= ss.format(now)%>");
//	alert("htmlTop" + htmlTop);
	htmlBottom=fc_RepStr(htmlBottomtmp,"(p)",curPage+"");
    htmlBottom=fc_RepStr(htmlBottom,"(yyyy)","<%= yyyy.format(now)%>");
    htmlBottom=fc_RepStr(htmlBottom,"(MM)","<%= MM.format(now)%>");
    htmlBottom=fc_RepStr(htmlBottom,"(dd)","<%= dd.format(now)%>");
    htmlBottom=fc_RepStr(htmlBottom,"(hh)","<%= hh.format(now)%>");
    htmlBottom=fc_RepStr(htmlBottom,"(mm)","<%= mm.format(now)%>");
    htmlBottom=fc_RepStr(htmlBottom,"(ss)","<%= ss.format(now)%>");
//	alert("htmlTop" + htmlBottom);
	

}
function window_onbeforeunload() {
	window.returnValue=prnSet
}

</SCRIPT>
<SCRIPT id=fcAdd>
function detachPage(){	
	htmlToptmp=htmlTop;
	htmlBottomtmp=htmlBottom;
	var iStart=0;
	var iEnd=0;
	var lngEndLine=t.rows.length-tabCauda; 
	var colwidthXML=LoadUserData("setcolwidth","ReportColWidth"+ReportName);
		effectiveWidth=parseInt(repWidth-tabLeft-tabRight);		
	var oXML1=new ActiveXObject("Microsoft.XMLDOM");
	oXML1.async="false";
	oXML1.loadXML("<root>" +colwidthXML+"</root>");	
	sumcol=0;
	var compressRate=1;
	if(prnSet.compressWidth==1) {
		
		for (var j=0;j<MaxCols;j++){
			if (oXML1.documentElement.childNodes.item(j).getAttribute("colSelect")=="block"){
				sumcol=sumcol+parseInt(oXML1.documentElement.childNodes.item(j).getAttribute("colWidth"));
			}
		}
	
		compressRate=effectiveWidth/(sumcol+MaxCols);  
		if(compressRate>=1 ) {
			compressRate=1;
		}
		compressColWidth(compressRate);	
	}
	//---------
	var hcompressRate=1; 
	var t_outerHTMLbak=t.outerHTML ;
	if(prnSet.compressHeight==1) {
		cur1=0;
		for (var i=tabHead;i<lngEndLine;i++)
		{	
			cur1=cur1+parseInt(t.rows(i).offsetHeight);
		}
		hcompressRate=(repHeight-tabBottom-tabTop-PageHeadHeight-PageCaudaHeight-heightTop-heightBottom)/(cur1+lngEndLine-tabHead);  
		if(hcompressRate>=1 ) {
			hcompressRate=1;
		}
		compressRowHeight(hcompressRate,tabHead,lngEndLine);	
	}
	//---------
	if (prnSet.compressFont!=1) {
		var compressFont=0;
		if(hcompressRate<compressRate) {
			compressFont=hcompressRate;
		}
		else {
			compressFont=compressRate;
		}
		if(compressFont<1){
			t.style.fontSize=parseFloat(t.style.fontSize)*compressFont;
		}
	}
	setAutoturnRow();

	//---------
	cur1=0;
	var sOtherPage="";
	for (var i=tabHead;i<lngEndLine;i++)
	{	
		cur1=cur1+parseInt(t.rows(i).offsetHeight);
		sOtherPage=t.rows(i).getAttribute("otherpage");
		if (sOtherPage=="1" || cur1>=repHeight-tabBottom-tabTop-PageHeadHeight-PageCaudaHeight-heightTop-heightBottom|| i==lngEndLine-1){
		if (sOtherPage=="1" || cur1==repHeight-tabBottom-tabTop-PageHeadHeight-PageCaudaHeight-heightTop-heightBottom) {
			cur1=0;
		}
		else {
			cur1=parseInt(t.rows(i).offsetHeight);
		}
		sumcol=0;
		var bFind=false;
		iStart=0;
		iEnd=0;
		if (sOtherPage=="1" || i==lngEndLine-1){
			perPageHTML=perPageHTML+t.rows(i).outerHTML	;
		}
		
		for (var j=0;j<MaxCols;j++){
		
			if (oXML1.documentElement.childNodes.item(j).getAttribute("colSelect")=="block"){
				sumcol=sumcol+parseInt(oXML1.documentElement.childNodes.item(j).getAttribute("colWidth"))*compressRate;
			}
			if (sumcol>=effectiveWidth || j==MaxCols-1){			
				if (sumcol<=effectiveWidth){
					iEnd=j;
					sumcol=0;
				}
				else {
					iEnd=j-1;
					sumcol=parseInt(oXML1.documentElement.childNodes.item(j).getAttribute("colWidth"))*compressRate;
				}
				var s1=HideCol(strCol,iStart,iEnd);
				bFind=true;
				PageDataAdd(Pages);
				arrPage[Pages]=htmlTop+htmlBottom+tabstyle+s1;
				arrPage[Pages]=arrPage[Pages]+PageHeadHTML;		
				arrPage[Pages]=arrPage[Pages]+perPageHTML+PageCaudaHTML+"</Table>"	+"<img >";
				if (i==lngEndLine-1){
					if(cur1>repHeight-tabBottom-tabTop-PageHeadHeight-PageCaudaHeight-heightTop-heightBottom){
						PageDataAdd(Pages+1);
						arrPage[Pages+1]=htmlTop+htmlBottom+tabstyle+s1;
						arrPage[Pages+1]=arrPage[Pages+1]+PageHeadHTML+PageCaudaHTML+"</Table>"+"<img >";
						biglabel.innerHTML=biglabel.innerHTML +"<div class='previewDiv' >正在计算...</DIV>";
						Pages=Pages+1;
					}
				}
				biglabel.innerHTML=biglabel.innerHTML +"<div class='previewDiv' >正在计算...</DIV>";
				Pages=Pages+1;
					
				if ((j==MaxCols-1 ) && (iEnd==j-1) ){

					var s1=HideCol(strCol,MaxCols-1,MaxCols-1);
					bFind=true;
					PageDataAdd(Pages);
					arrPage[Pages]=htmlTop+htmlBottom+tabstyle+s1;
					arrPage[Pages]=arrPage[Pages]+PageHeadHTML;		
					arrPage[Pages]=arrPage[Pages]+perPageHTML+PageCaudaHTML+"</Table>"+"<img >";
					if (i==lngEndLine-1){
						if(cur1>repHeight-tabBottom-tabTop-PageHeadHeight-PageCaudaHeight-heightTop-heightBottom){
							PageDataAdd(Pages+1);
							arrPage[Pages+1]=htmlTop+htmlBottom+tabstyle+s1	;
							arrPage[Pages+1]=arrPage[Pages+1]+PageHeadHTML+PageCaudaHTML+"</Table>"+"<img >";
							biglabel.innerHTML=biglabel.innerHTML +"<div class='previewDiv' >正在计算...</DIV>";
							Pages=Pages+1;
						}
					}
					biglabel.innerHTML=biglabel.innerHTML +"<div class='previewDiv' >正在计算...</DIV>";
					Pages=Pages+1;

				}			
					
				iStart=iEnd+1;
			}  
			
		}   
		
		perPageHTML="";
		}	
		if(sOtherPage!="1")
			perPageHTML=perPageHTML+t.rows(i).outerHTML	;
	}   
	mdblRate=1;
	htmlTop="";
	htmlBottom="";
	t.outerHTML=t_outerHTMLbak;
	t.style.display="none";

	for(var i=0;i<Pages;i++){
		arrPage[i]=fc_RepStr(arrPage[i],"(P)",Pages+"");
	}
}

</SCRIPT>
</head>


<body bgColor=#858382 onafterprint="return window_onafterprint()" onbeforeprint ="return window_onbeforeprint()"   onload="return window_onload() " onbeforeunload="return window_onbeforeunload()">

<span id=tipPrint style="display:block;color:red;top:0px;left:0px;height:90px;width:300px" >正在计算打印数据,请稍候......</span>

<TABLE id=toolbar  bgcolor=silver style="FONT-SIZE: 14px; HEIGHT: 25px; WIDTH: 100%" border=1 vspace="0" bordercolordark="#ffffff" bordercolorlight="#898989" cellpadding=0 cellspacing=0>
  <TBODY>
  <TR>
    <td width=1 style="BORDER-BOTTOM: dimgray 1px solid; BORDER-LEFT: white 1px solid; BORDER-RIGHT: dimgray 1px solid; BORDER-TOP: white 1px solid; WIDTH: 0px" ></td>
    <TD align=middle LANGUAGE=javascript style="BORDER-BOTTOM: dimgray 1px solid; BORDER-LEFT: white 1px solid; BORDER-RIGHT: dimgray 1px solid; BORDER-TOP: white 1px solid; WIDTH: 80px" onclick="return cmdPrint_onclick()" width=80>打印</TD>
    <TD align=middle  id=setpageface LANGUAGE=javascript onclick="return setpageface_onclick()" style="BORDER-BOTTOM: dimgray 1px solid; BORDER-LEFT: white 1px solid; BORDER-RIGHT: dimgray 1px solid; BORDER-TOP: white 1px solid; WIDTH: 100px" >页面设置</TD>
    <TD id=setappendinfo LANGUAGE=javascript onclick="return setappendinfo_onclick()" align=middle style="WIDTH: 100px" >附加信息设置</TD>
    <td align=left valign=middle >比例<span style="HEIGHT: 22px; WIDTH: 100px" ></span></td>
    <TD id=curTD align=middle ></TD>  
    <td style="BORDER-BOTTOM: dimgray 1px solid; BORDER-LEFT: white 1px solid; BORDER-RIGHT: dimgray 1px solid; BORDER-TOP: white 1px solid; WIDTH: 50px" align=middle LANGUAGE=javascript onclick="return close_onclick()">关闭</td>
  </TR></TBODY>
</TABLE>
<label id=biglabel border="0" style="BACKGROUND-COLOR: #858382; DISPLAY: block; HEIGHT: 500px;  POSITION: absolute; WIDTH: 0px"></label>
<div id=loadtab style="DISPLAY: block; LEFT: 3000px"></div>
<form id="oForm">
	<input Class="userData" style="DISPLAY: none;  HEIGHT: 22px; WIDTH: 26px" ID="oInput">
</form>
<fc:fc_code id=cboZoom onselchange="cboZoom_onchange()" onkeypress="cboZoom_onkeypress()"></fc:fc_code>
</body></HTML>
